<template>
  <free-app bgType="image" :showNavbar="true" :navbar="navbarOptions">
    <view class="p-3 flex flex-col gap-3">
      <!-- serach -->
      <SearchBox placeholder="请输入关键字"></SearchBox>
      <view class="flex flex-col gap-3">
        <view
          class="flex rounded-[24rpx] gap-[20rpx] p-3"
          v-for="(item, index) in subCategories"
          :key="index"
        >
          <goodsCard
            :data="item"
            :showSpecBtn="true"
            class="flex-1 w-full"
          ></goodsCard>
        </view>
      </view>
    </view>
  </free-app>
</template>

<script setup>
import { ref } from "vue";
import SearchBox from "@/components/search-box/index.vue";
import goodsCard from "@/components/goods-card/index.vue";
import { onUnload, onLoad } from "@dcloudio/uni-app";
// const userStore = useUserStore();
const navbarOptions = {
  title: "搜索",
  placeholder: true,
};
const chooseStore = async (city) => {
  uni.navigateBack({
    delta: 1,
  });
};
const subCategories = ref(
  new Array(24).fill(null).map(() => ({
    imgUrl: "/static/images/temp/logo.png",
    title: "移修适用于苹果11 屏幕（标准）",
    description: "适配型号苹果12/苹果12Pro",
    price: "129.9",
    stock: 129,
    num: 0,
  }))
);
onLoad(() => {
  console.log(subCategories.value);
});
onUnload(() => {
  uni.$emit("refreshhome");
});
</script>

<style lang="scss" scoped></style>
